<template>
  <div class="ranking">
    <h1><i class="el-icon-medal"></i>本周药品排行榜</h1>
    <el-table
      ref="singleTable"
      :data="newA"
      highlight-current-row
      @current-change="handleCurrentChange"
      style="width: 100%"
    >
      <el-table-column type="index" width="40"> </el-table-column>
      <el-table-column property="queque" width="110"> </el-table-column>
      <el-table-column property="name" width="120">
        <template slot-scope="scope">
          {{ nameOb[scope.row.name] }}
        </template>
      </el-table-column>
     
      <el-table-column property="add" >
        <el-button type="success" @click="addFun">添加</el-button>
         </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: ["newA"],
  data() {
    return {
      nameOb: {
        //映射对象
        0: "兰索拉唑肠溶片",
        1: "甲钴胺片",
        2: "复方求唑沙宗胶囊",
        3: "对乙酰氨基酚片",
        4: "双嘧达膜片",
        5: "阿莫西林胶囊",
        6: "骨肽注射液",
        7: "双氯扽双那肠溶片",
        8: "滴眼用利福平",
        9: "红霉素眼膏",
      },
      // tableData: [
      //   {
      //     queque: "10001",
      //     name: "0", //0代表兰索拉唑肠溶片，1代表甲钴胺片，2代表复方求唑沙宗胶囊,3代表对乙酰氨基酚片，4代表双嘧达膜片，5代表阿莫西林胶囊，6代表骨肽注射液，7代表双氯扽双那肠溶片，8代表滴眼用利福平，9代表红霉素眼膏
      //     add: "添加",
      //   },
      // ],
      currentRow: null,
    };
  },
 

  methods: {
 addFun(){
   this.$emit('addDrug')
 },
    setCurrent(row) {
      this.$refs.singleTable.setCurrentRow(row);
    },
    handleCurrentChange(val) {
      this.currentRow = val;
    },
  },
};
</script>

<style lang="less">
.ranking .el-table__cell .cell div {
  color: #666ee8;
  font-size: 16px;
  font-weight: bold;
}
.ranking .is-scrolling-none tbody tr td:nth-child(4) {
  color: #666ee8;
  font-weight: 800;
  &:hover {
    cursor: pointer;
    color: red;
  }
}
.ranking {
 margin: 30px;
  overflow-y: auto;
  box-shadow: 0 0 4px rgb(43, 37, 37);
  border-radius: 5px;
  h1 {
    margin: 24px;
    font-weight: 900;
    font-size: 20px;
    line-height: 24px;
    .el-icon-medal {
      font-size: 24px;
      color: #d6b313;
      font-weight: 900;
      float: left;
      margin: 0 8px;
    }
  }
}
</style>
